{extend name="main/index" /}
{block name="main"}
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>  
        <script>  
              
            function ajaxPost(){  
                var formData = $("#creator").serialize();  
                
                $.ajax({  
                    type:"post",  
                    url:"{:url('admin/role/docreate')}",  
                    data:formData,
                    dataType:'text',
                    success:function(data){  
                      if(data){
                        	alert("创建成功");
                        }else{
                        	alert("创建失败");
                        }
                    }

                });  
            } 
            
              
</script> 
<div class="content-page">
    <div class="content">
        <h1>添加角色</h1>
        <form id="creator">
        	<table class="col-md-5  table-bordered"  style="text-align: center;border-collapse:separate;border-spacing:0 0.5rem;">
        		<tr>
        			<td>
        				角色名
        			</td>
        			<td>
        				<input type="text" name="role_name"> 
        			</td>
        		</tr>
        		<tr>
        			<td>
        				角色说明
        			</td>
        			<td>
        				<input type="text" name="role_coment"> 
        				
        			</td>
        		</tr>
        		<tr>
        			<td class="col-md-4">
        				权限:
        			</td>
        			<td >
        			
        				{volist name="list" id="vo"}
        					
        					<?php
        						if($i%2!=0){
        							echo "<p>";
        							
        						}
        					?>
        					<span>{$vo.pri_name}</span>
	        				<span>
	        					<input type="checkbox" name="pri[]" value="{$vo.id}" />
	        				</span>
        					<?php
        						
        						if($i%2==0){
        							echo "</p>";
        						}
        					?>
        					
        				{/volist}
        				
        			</td>
        		</tr>
        		
        		
        		
        		
        		<tr>
        			<td colspan="2">
        				<button onclick="ajaxPost()" style="margin: 10px;">创建角色</button>
        			</td>
        		</tr>
        	</table>
        	
        	
        </form>
    </div>
</div>

{/block}